#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
#include "errsys.h"

int main(int argc, char **argv)
{
	if(argc==1)
	{
		fprintf(stderr,"Usage:%s file\n");
		exit(1);
	}

	struct stat st;
	int ret=stat(argv[1], &st);
	if(ret==-1)
		err_sys("stat");

	printf("st_mode:oct:%-o\n",st.st_mode);
	printf("st_ino:     %-d\n",st.st_ino);
	printf("st_dev:     %-d\n",st.st_dev);
	printf("st_rdev:    %-d\n",st.st_rdev);
	printf("st_nlink:   %-d\n",st.st_nlink);
	printf("st_uid:     %-d\n",st.st_uid);
	printf("st_gid:     %-d\n",st.st_gid);
	printf("st_size:    %-d\n",st.st_size);
	printf("st_atime:   %-d\n",st.st_atime);
	printf("st_mtime:   %-d\n",st.st_mtime);
	printf("st_ctime:   %-d\n",st.st_ctime);
	printf("st_blksize: %-d\n",st.st_blksize);
	printf("st_blocks:  %-d\n",st.st_blocks);
	return 0;
}

